In my client side javascript code, there is a blob that I need to download with a specific file extension (.3dxml => 3D design model file). For this, I create a hidden html "a" tag, link the blob url to this tag, and specify the intended filename with extension (e.g. xyz.3dxml). I then simulate a click event on this link. This works fine in windows desktop chrome browser. But in and Android Chrome browser, after downloading this file appears as "xyz.3dxml.txt". This issue does not occur if I use a more standard file extension (e.g. *.stl).
I use the following code. Please let me know if you have any suggestions/advice.
var blob = new Blob([bufferOut]);
var url = window.URL;
var objectURL = url.createObjectURL(blob);
var doc = window.document;
var saveLink = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");
saveLink.href = objectURL;
saveLink.download = "xyz.3dxml";
saveLink.type = 'application/octet-stream';
var event = doc.createEvent("MouseEvents");
event.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
saveLink.dispatchEvent(event);
url.revokeObjectURL(objectURL);